<template>
  <div class="answersbox">
    <div class="title">第{{ idx }}题 （{{ item.score }} 分）</div>

    <div class="number">
      得分：
      <el-input-number
        v-model="item.myScore"
        controls-position="right"
        @change="handleChange"
        :min="0"
        :max="Number(item.score)"
      ></el-input-number>
    </div>

    <h4>[问答题] {{ item.title }}</h4>

    <!-- <input type="text"   disabled> -->

    <div class="input">{{ item.myAnswers || "未答题" }}</div>
    <div class="analysis">
      <h5>判分关键词</h5>
      <p v-for="(it, idx) in JSON.parse(item.options)" :key="idx">
        关键词1：{{ JSON.parse(it).keywords }}
        <span>得分比例：{{ JSON.parse(it).num }} %</span>
      </p>
    </div>

    <div class="analysis">
      <h5>答案解析</h5>
      <p>{{ item.answers }}</p>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      num: 0,
    };
  },
  props: {
    item: {
      type: Object,
    },
    idx: {
      type: Number,
    },
  },
  created() {},
  methods: {
    handleChange() {
      // console.log('JSON.parse(options)',JSON.parse(options))
    },
  },
};
</script>

<style lang="scss" scoped>
.answersbox {
  padding-top: 20px;
  border-bottom: 1px solid #f0f0f0;
  position: relative;

  .number {
    position: absolute;
    top: 10px;
    right: 10px;
  }

  .title {
    color: #8c8c8c;
    font-size: 15px;
    font-variant: tabular-nums;
    line-height: 1.5715;
  }

  h4 {
    font-size: 16px;
    line-height: 1.5;
    margin: 10px 0 4px;
    font-weight: 500;
  }

  h5 {
    font-size: 15px;
    line-height: 1.5;
    margin: 10px 0 6px;
    font-weight: 500;
  }

  .analysis {
    p {
      color: #8c8c8c;
      white-space: pre-line;
      word-break: break-all;
      margin-bottom: 8px;
      font-size: 15px;
    }

    span {
      padding-left: 20px;
      color: #2e3d58;
    }
  }

  .input {
    display: inline-block;
    border: 1px solid #dadada;
    border-radius: 4px;
    font-size: 15px;
    padding: 8px;
    margin-top: 4px;
    width: 100%;
    min-height: 30px;
    line-height: 30px;
  }
}
</style>
